﻿Public Class Form1

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        'Try
        Dim etsy As EtsyNET.EtsyNET = New EtsyNET.EtsyNET("") '<<--- Add your api key here! (http://developer.etsy.com)

        '=====================================================================================================
        ' User Commands 
        '=====================================================================================================
        'Dim Seller1 As EtsyNET.User = etsy.getUserDetails("Craftyallsorts", EtsyNET.Enums.detail_level.high)

        '=====================================================================================================
        'Dim Sellers As EtsyNET.Users(Of EtsyNET.User) = etsy.getUsersByName("rob", 100, EtsyNET.Enums.detail_level.high, 301)
        'For Each x As EtsyNET.User In Sellers
        '    Console.WriteLine("{0} joined on {1:dd-MM-yy}", x.UserName, x.Join)
        'Next

        '=====================================================================================================
        ' Shop Commands 
        '=====================================================================================================
        'Dim shop As EtsyNET.Shop = etsy.getShopDetails("Craftyallsorts", EtsyNET.Enums.detail_level.high)

        '=====================================================================================================
        'Dim Listings1 As EtsyNET.Listings(Of EtsyNET.Listing) = etsy.getShopListings("luccicare", _
        '                                                                             EtsyNET.Enums.sort_on.created, _
        '                                                                             EtsyNET.Enums.sort_order.down, _
        '                                                                             , _
        '                                                                             100, _
        '                                                                             EtsyNET.Enums.detail_level.high, _
        '                                                                             0)
        'For Each x As EtsyNET.Listing In Listings1
        '    'Console.WriteLine("{0} by {1} @ {2} {3}", x.Title, x.UserName, x.Price, x.CurrencyCode)
        '    Console.WriteLine(" ... [{0}]", x.State)
        'Next

        '=====================================================================================================
        'Dim Listings2 As EtsyNET.Listings(Of EtsyNET.Listing) = etsy.getFeaturedDetails("craftyaLLSORTS", EtsyNET.Enums.detail_level.high)
        'For Each x As EtsyNET.Listing In Listings2
        '    'Console.WriteLine("{0} by {1} @ {2}", x.Title, x.Price, x.CurrencyCode)
        '    Console.WriteLine(" ... [{0}]", x.State)
        'Next

        '=====================================================================================================
        'Dim FeaturedSellers As EtsyNET.Shops(Of EtsyNET.Shop) = etsy.getFeaturedSellers(100, EtsyNET.Enums.detail_level.high, 0)
        'For Each x As EtsyNET.Shop In FeaturedSellers
        '    Console.WriteLine("FS: {0} joined on {1:dd-MM-yy}", x.UserName, x.Join)
        'Next

        '=====================================================================================================
        'Dim shops1 As EtsyNET.Shops(Of EtsyNET.Shop) = etsy.getShopsByName("crafty", 100, EtsyNET.Enums.detail_level.high, EtsyNET.Enums.sort_order.up)
        'For Each x As EtsyNET.Shop In shops1
        '    Console.WriteLine("SSN: {0}", x.ShopName)
        'Next

        '=====================================================================================================
        ' Listing Commands 
        '=====================================================================================================
        'Dim listing As EtsyNET.Listing = etsy.getListingDetails(17659138, EtsyNET.Enums.detail_level.high)

        '=====================================================================================================
        'Dim Listings3 As EtsyNET.Listings(Of EtsyNET.Listing) = etsy.getAllListings(100, _
        '                                                                            EtsyNET.Enums.detail_level.high, _
        '                                                                            EtsyNET.Enums.sort_on.price, _
        '                                                                            EtsyNET.Enums.sort_order.down, _
        '                                                                            0)
        'For Each x As EtsyNET.Listing In Listings3
        '    'Console.WriteLine("{0} by {1} @ {2} {3}", x.Title, x.UserName, x.Price, x.CurrencyCode)
        '    Console.WriteLine(" ... [{0}]", x.State)
        'Next

        '=====================================================================================================
        'Dim Listings4 As EtsyNET.Listings(Of EtsyNET.Listing) = etsy.getListingsByCategory("jewelry", _
        '                                                                                   100, _
        '                                                                                   EtsyNET.Enums.detail_level.high, _
        '                                                                                   EtsyNET.Enums.sort_on.price, _
        '                                                                                   EtsyNET.Enums.sort_order.down, _
        '                                                                                   0)
        'For Each x As EtsyNET.Listing In Listings4
        '    'Console.WriteLine("{0} by {1} @ {2} {3}", x.Title, x.UserName, x.Price, x.CurrencyCode)
        '    Console.WriteLine(" ... [{0}]", x.State)
        'Next

        '=====================================================================================================
        'Dim Listings5 As EtsyNET.Listings(Of EtsyNET.Listing) = etsy.getListingsByColor(New EtsyNET.ColorHSV("0;100;100"), _
        '                                                                                5, _
        '                                                                                100, _
        '                                                                                EtsyNET.Enums.detail_level.high, _
        '                                                                                0)
        'For Each x As EtsyNET.Listing In Listings5
        '    'Console.WriteLine("{0} by {1} @ {2} {3}", x.Title, x.UserName, x.Price, x.CurrencyCode)
        '    Console.WriteLine(" ... [{0}]", x.State)
        'Next

        '=====================================================================================================
        'Dim Listings6 As EtsyNET.Listings(Of EtsyNET.Listing) = etsy.getListingsByColorAndKeywords("jewelry", _
        '                                                                                           New EtsyNET.ColorHSV("0;100;100"), _
        '                                                                                           15, _
        '                                                                                           100, _
        '                                                                                           EtsyNET.Enums.detail_level.high, _
        '                                                                                           0)
        'For Each x As EtsyNET.Listing In Listings6
        '    'Console.WriteLine("{0} by {1} @ {2} {3}", x.Title, x.UserName, x.Price, x.CurrencyCode)
        '    Console.WriteLine(" ... [{0}]", x.State)
        'Next

        '=====================================================================================================
        'Dim Listings7 As EtsyNET.Listings(Of EtsyNET.Listing) = etsy.getFrontFeaturedListings(100, EtsyNET.Enums.detail_level.high)
        'For Each x As EtsyNET.Listing In Listings7
        '    'Console.WriteLine("{0} by {1} @ {2} {3}", x.Title, x.UserName, x.Price, x.CurrencyCode)
        '    Console.WriteLine(" ... [{0}]", x.State)
        'Next

        '=====================================================================================================
        'Dim Listings8 As EtsyNET.Listings(Of EtsyNET.Listing) = etsy.getListingsByKeyword("jewelry bead pandora", _
        '                                                                                  20D, 60D, _
        '                                                                                  100, _
        '                                                                                  EtsyNET.Enums.detail_level.high, _
        '                                                                                  EtsyNET.Enums.sort_on.price, _
        '                                                                                  EtsyNET.Enums.sort_order.down, , _
        '                                                                                  0)
        'For Each x As EtsyNET.Listing In Listings8
        '    'Console.WriteLine("{0} by {1} @ {2} {3}", x.Title, x.UserName, x.Price, x.CurrencyCode)
        '    Console.WriteLine(" ... [{0}]", x.State)
        'Next

        '=====================================================================================================
        'Dim Listings9 As EtsyNET.Listings(Of EtsyNET.Listing) = etsy.getListingsByMaterials("natural_brass", _
        '                                                                                    100, _
        '                                                                                    EtsyNET.Enums.detail_level.high, _
        '                                                                                    EtsyNET.Enums.sort_on.price, _
        '                                                                                    EtsyNET.Enums.sort_order.down, _
        '                                                                                    0)
        'For Each x As EtsyNET.Listing In Listings9
        '    'Console.WriteLine("{0} by {1} @ {2} {3}", x.Title, x.UserName, x.Price, x.CurrencyCode)
        '    Console.WriteLine(" ... [{0}]", x.State)
        'Next

        '=====================================================================================================
        'Dim Listings10 As EtsyNET.Listings(Of EtsyNET.Listing) = etsy.getListingsByTags("glass", _
        '                                                                                100, _
        '                                                                                EtsyNET.Enums.detail_level.high, _
        '                                                                                EtsyNET.Enums.sort_on.price, _
        '                                                                                EtsyNET.Enums.sort_order.down, _
        '                                                                                0)
        'For Each x As EtsyNET.Listing In Listings10
        '    'Console.WriteLine("{0} by {1} @ {2} {3}", x.Title, x.UserName, x.Price, x.CurrencyCode)
        '    Console.WriteLine(" ... [{0}]", x.State)
        'Next

        '=====================================================================================================
        ' Feedback Commands 
        '=====================================================================================================
        'Dim feedbacks1 As EtsyNET.FeedBacks(Of EtsyNET.Feedback) = etsy.getFeedbackForUser("Craftyallsorts", 100, 0)
        'For Each x As EtsyNET.Feedback In feedbacks1
        '    Console.WriteLine("By {0} @ {1} Msg: {2}", x.AuthorUserID, x.Creation, x.Message)
        'Next

        '=====================================================================================================
        'Dim feedbacks2 As EtsyNET.FeedBacks(Of EtsyNET.Feedback) = etsy.getFeedbackAsBuyer("Craftyallsorts", 100, 0)
        'For Each x As EtsyNET.Feedback In feedbacks2
        '    Console.WriteLine("By {0} @ {1} Msg: {2}", x.AuthorUserID, x.Creation, x.Message)
        'Next

        '=====================================================================================================
        'Dim feedbacks3 As EtsyNET.FeedBacks(Of EtsyNET.Feedback) = etsy.getFeedbackForOthers("Craftyallsorts", 100, 0)
        'For Each x As EtsyNET.Feedback In feedbacks3
        '    Console.WriteLine("By {0} @ {1} Msg: {2}", x.AuthorUserID, x.Creation, x.Message)
        'Next

        '=====================================================================================================
        'Dim feedbacks4 As EtsyNET.FeedBacks(Of EtsyNET.Feedback) = etsy.getFeedbackAsSeller("Craftyallsorts", 100, 0)
        'For Each x As EtsyNET.Feedback In feedbacks4
        '    Console.WriteLine("By {0} @ {1} Msg: {2}", x.AuthorUserID, x.Creation, x.Message)
        'Next

        '=====================================================================================================
        ' Tag Commands 
        '=====================================================================================================
        'Dim Categories As ArrayList = etsy.getTopCategories()
        'For Each category As String In Categories
        '    Console.WriteLine(category)
        '    Dim child_Categories As ArrayList = etsy.getChildCategories(category)
        '    For Each child_category As String In child_Categories
        '        Console.WriteLine("... {0}", child_category)
        '    Next
        'Next

        'Dim tags As ArrayList = etsy.getTopTags()
        'For Each Tag As String In tags
        '    Console.WriteLine(Tag)
        '    Dim child_tags As ArrayList = etsy.getChildTags(Tag)
        '    For Each child_tag As String In child_tags
        '        Console.WriteLine("... {0}", child_tag)
        '    Next
        'Next

        '=====================================================================================================
        ' Favorites Commands 
        '=====================================================================================================
        'Dim Users1 As EtsyNET.Users(Of EtsyNET.User) = etsy.getFavorersOfListing(20161302, _
        '                                                                         100, _
        '                                                                         EtsyNET.Enums.detail_level.high, _
        '                                                                         0)
        'For Each x As EtsyNET.User In Users1
        '    Console.WriteLine("{0} joined on {1:dd-MM-yy} - Ststus {2}", x.UserName, x.Join, x.Status)
        'Next

        '=====================================================================================================
        'Dim Users2 As EtsyNET.Users(Of EtsyNET.User) = etsy.getFavorersOfShop("robgrantart", _
        '                                                                      100, _
        '                                                                      EtsyNET.Enums.detail_level.high, _
        '                                                                      0)
        'For Each x As EtsyNET.User In Users2
        '    Console.WriteLine("{0} joined on {1:dd-MM-yy} - Ststus {2}", x.UserName, x.Join, x.Status)
        'Next

        '=====================================================================================================
        'Dim Listings11 As EtsyNET.Listings(Of EtsyNET.Listing) = etsy.getFavoriteListingsOfUser("craftyallsorts", _
        '                                                                                        100, _
        '                                                                                        EtsyNET.Enums.detail_level.high, _
        '                                                                                        0)
        Dim offset11 As Integer = 101
        Dim Listings11 As EtsyNET.Listings(Of EtsyNET.Listing)
        Do
            Listings11 = etsy.getFavoriteListingsOfUser("CraftyAllSorts", _
                                                        100, _
                                                        EtsyNET.Enums.detail_level.high, _
                                                        offset11)
            For Each x As EtsyNET.Listing In Listings11
                Console.WriteLine(" ... {0} by {1} @ {2} {3}", x.Title, x.UserName, x.Price, x.CurrencyCode)
                'Console.WriteLine(" ... [{0}]", item.State)
            Next
            If offset11 = 0 Then offset11 += 1
            offset11 += 100
        Loop Until Listings11.ResultCount < offset11
        'Console.WriteLine("{0} by {1} @ {2} {3}", IIf((x.State = EtsyNET.Enums.listing_state.Removed OrElse _
        '                                               x.State = EtsyNET.Enums.listing_state.Edit), String.Format("*** {0} ***", x.State), x.Title), _
        '                                          x.UserName, x.Price, x.CurrencyCode)
        'Console.WriteLine(" ... [{0}]", x.State)
        'Next

        '=====================================================================================================
        'Dim Shops2 As EtsyNET.Shops(Of EtsyNET.Shop) = etsy.getFavoriteShopsOfUser("robgrantart", _
        '                                                                           100, _
        '                                                                           EtsyNET.Enums.detail_level.high, _
        '                                                                           0)
        'For Each x As EtsyNET.Shop In Shops2
        '    Console.WriteLine("{0} joined on {1:dd-MM-yy}", x.ShopName, x.Join)
        'Next

        '=====================================================================================================
        ' Gift Guide Commands 
        '=====================================================================================================
        'Dim GiftGuides As EtsyNET.GiftGuides(Of EtsyNET.GiftGuide) = etsy.getGiftGuides()
        'For Each guide As EtsyNET.GiftGuide In GiftGuides
        '    Console.WriteLine("Guide ID:{2} || Title:{0} || Title:{1}", guide.GuideSectionTitle, guide.Title, guide.GuideID)
        '    Dim offset As Integer = 0
        '    Dim Listings As EtsyNET.Listings(Of EtsyNET.Listing)
        '    Do
        '        Listings = etsy.getGiftGuideListings(guide.GuideID, _
        '                                             100, _
        '                                             EtsyNET.Enums.detail_level.high, _
        '                                             offset)
        '        Console.WriteLine("Count:{0} || Offset:{1} || Limit:{2}", Listings.ResultCount, offset, 100)
        '        For Each item As EtsyNET.Listing In Listings
        '            Try
        '                Console.WriteLine(" ... {0} by {1} @ {2} {3}", item.Title, item.UserName, item.Price, item.CurrencyCode)
        '            Catch ex As Exception

        '            End Try

        '            'Console.WriteLine(" ... [{0}]", item.State)
        '        Next
        '        If offset = 0 Then offset += 1
        '        offset += 100
        '    Loop Until Listings.ResultCount < offset
        'Next

        '=====================================================================================================
        ' Server Commands 
        '=====================================================================================================
        'Dim methods As EtsyNET.Methods(Of EtsyNET.Method) = etsy.getMethodTable()
        'Console.WriteLine("Total Methods Found: {0}", methods.ResultCount)
        'For Each method As EtsyNET.Method In methods
        '    Console.WriteLine("--------------------------------------------------------------")
        '    Console.WriteLine("       Name: {0}", method.Name)
        '    Console.WriteLine("Description: {0}", method.Description)
        '    Console.WriteLine("        URI: {0}", method.URI)
        '    Console.WriteLine("     Params: ")
        '    If Not method.Params Is Nothing Then
        '        For Each key As String In method.Params.Keys
        '            Console.WriteLine("             {0} > {1}", key, method.Params(key))
        '        Next
        '    End If
        '    Console.WriteLine("       Type: {0}", method.Type)
        '    Console.WriteLine("HTTP Method: {0}", method.HTTP_Method)
        'Next

        '=====================================================================================================
        Console.WriteLine(etsy.Ping)

        '=====================================================================================================
        Console.WriteLine("{0:dd-MM-yy hh:mm:ss}", etsy.getServerEpoch)


        Console.WriteLine(" --- Done! --- ")
        'Catch ex As Exception
        '    MessageBox.Show(ex.Message)
        'End Try

    End Sub

End Class
